<template>
	<view class="payment">
		<view class="title">
			<text>支付方式</text>
			<view class="close" @click="close">
				<image src="@/static/images/close.png"></image>
			</view>
		</view>
		<view class="list">
			<view class="item" @click="active=1">
				<view>微信支付</view>
				<image src="@/static/images/checked.png" v-if="active==1"></image>
				<image src="@/static/images/checked_no.png" v-else></image>
			</view>
			<view class="item" @click="active=2">
				<view>余额支付</view>
				<image src="@/static/images/checked.png" v-if="active==2"></image>
				<image src="@/static/images/checked_no.png" v-else></image>
			</view>
		</view>
		<view class="submit">
			<view @click="submit">提交</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue";
	const emit = defineEmits(["close", "submit"]);
	const active = ref("1");

	const submit = async () => emit('submit', active.value);
	const close = () => emit('close');
</script>

<style scoped lang="scss">
	.payment {
		width: 100%;
		border-radius: 20rpx 20rpx 0rpx 0rpx;
		box-sizing: border-box;
		overflow: hidden;
		background: #FFFFFF;

		.title {
			text-align: center;
			color: #222222;
			font-size: 36rpx;
			font-weight: bold;
			padding: 40rpx 0 50rpx;
			box-sizing: border-box;
			position: relative;

			.close {
				position: absolute;
				right: 25rpx;
				top: 50%;
				transform: translateY(-50%);
				z-index: 2;

				image {
					width: 40rpx;
					height: 40rpx;
				}
			}
		}

		.list {
			border-top: 4rpx solid #F8F8F8;
			border-bottom: 4rpx solid #F8F8F8;
			padding: 30rpx 20rpx;
			box-sizing: border-box;

			.item {
				padding: 30rpx 0rpx;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				align-items: center;

				image {
					width: 40rpx;
					height: 40rpx;
				}

				view {
					color: #222222;
					font-size: 28rpx;
					padding-left: 24rpx;
					box-sizing: border-box;
				}
			}
		}

		.submit {
			width: 100%;
			height: 180rpx;

			padding: 0 30rpx 15rpx;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
			justify-content: flex-end;

			view {
				width: 100%;
				height: 78rpx;
				line-height: 78rpx;
				text-align: center;
				color: #FFFFFF;
				font-size: 30rpx;
				font-weight: bold;
				border-radius: 10rpx;
				background: #CA1C1D;
			}
		}
	}
</style>